import request from '@/utils/request'

export const detectionModelService = {
  // 获取检测模型列表
  getDetectionModels(params) {
    return request({
      url: '/detection-models',
      method: 'get',
      params
    }).then(response => response.data)
  },
  
  // 获取检测模型详情
  getDetectionModelDetail(id) {
    return request({
      url: `/detection-models/${id}`,
      method: 'get'
    }).then(response => response.data)
  },
  
  // 创建检测模型
  createDetectionModel(data) {
    return request({
      url: '/detection-models',
      method: 'post',
      data
    }).then(response => response.data)
  },
  
  // 更新检测模型
  updateDetectionModel(id, data) {
    return request({
      url: `/detection-models/${id}`,
      method: 'put',
      data
    }).then(response => response.data)
  },
  
  // 删除检测模型
  deleteDetectionModel(id) {
    return request({
      url: `/detection-models/${id}`,
      method: 'delete'
    }).then(response => response.data)
  },
  
  // 更新检测模型状态
  updateDetectionModelStatus(id, status) {
    return request({
      url: `/detection-models/${id}/status`,
      method: 'put',
      data: { is_active: status }
    }).then(response => response.data)
  },
  
  // 获取检测模型选项
  getDetectionModelOptions() {
    return request({
      url: '/detection-models/options',
      method: 'get'
    })
  }
}